package com.ffyc.resale.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ffyc.resale.model.Comment;
import com.ffyc.resale.model.Goods;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 操作comment相关数据接口
 */
public interface CommentDao extends BaseMapper<Comment> {

    /**
     * 新增
     */
    int insert(Comment comment);

    /**
     * 删除
     */
    int deleteById(Integer id);
    ;

    /**
     * 查询所有
     */
    List<Comment> selectAll(Comment comment);

    List<Comment> selectTree(@Param("fid") Integer fid, @Param("module") String module);

    @Select("select count(*) from comment where fid = #{fid} and module = #{module}")
    Integer selectCount(@Param("fid") Integer fid, @Param("module") String module);

    @Select("select * from comment where pid = #{pid}")
    List<Comment> selectByPid(Integer pid);
}